package com.powernode.money.web.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000117651308";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCQfIFIQBpEZlM2+ChtDlsD6wF1pfWNZsQ10JDtAXculwFPzmW5j//w21PDBji0gWkkNIyhZyEd/8L8lEJ+5Xh2/mBKyCF47M6RS1bbv+i8PCaTdoyqQ20Ko1F1czdaRMyb9/RuHrQoAuiEuDY1EugyWDIs781rt8oRJebpRKsm/bxumEQbt7wZpAQSsofnsZEsX0R5Th6DPAKE+Al7c0J92MCwNYRXF1lBecJHsSg9Z4SJdXduw2bZkURrvufE78NU3Dgs/qocV1tc35WmN2O+/x9b07mx7oHRQ+G8PMNYu5T9QDj+7ckVHuDdByf3MD9wYu7g2hOjeAHeDbIitygHAgMBAAECggEALrdy/a9sTs1e/pkCSTCpEP09PZLpcEzYCCZllZwxsui0Td+IWJVMxc3EqXwrfYGSQ1iSV+WGebKmkxBE586+QotBCyzmVbkLmULo1KiaUbKJLojYNn0SlqvzvKwCK7evCIcFi012JrG6CJ+fN03jsdN+dbUbkEaemSjOHoJLbJGFcPIMjVk4f1MWLE+1YfPjxgHnUZj/0OOajhLvZ6cTkBdflXjtFmFNARsablFh9WOPGwH2QlPSUWnEqC8k1kL6+s8pjTdKGleIA3NsfVuWIWTt+vbyEiUfUIYoBfoZ5AlgT9Je2VQ7oiHd1g9BE+fkbMT7L4Muk51dcNtgS7CcwQKBgQDMS6uCrY+SULTuEdc3YzZuUb991sJZTrwoVd5j0GMZOK4APfgWyxBiTEwdfA2sWDIVgd1omZyaqJ1Ktauinf40T9i4Ea0F8CLLI7YIAdrxj25O/6tCWgWROiIXwGMCG+Nr/jQ9nRrctM7BvPdS+0AXbiUi8Zb/if4g1Mgqz2ertwKBgQC1Dcn3x1fD0DAKVxfxCDLesXrEcTPf9EI+ujV9C1HwyedRjhfM5mPBaLinwBEteq7LkIiBmamzjgyrIsi3izgxwWfdzb9lFtmpDOEp4/SaPDCVNjx1yKlBILHQaMwOb0ewdcW1s5mx/t9O2MUPWKlVHKJDoP7qXI0sCI+e3u8GMQKBgQDK8IhJYbvzLrTsoVBXNvkFEbPVf5bEPJBwyQwHvyQSE9nVZ7mgesulugEKcQbsIxhtgPm+RInqoIDPjDQZcDTrJj40a2qjMW5+uNTEk4M43rBHTXaEjQRmxYbEbVps5+M8jeK7KetbP0j774kIJ4n9PG8rjS3gXuXRG05UKH/ldQKBgBcGxOwFZ00ZGjMGdp4KC+Y0rkdzmkReXVp69jiMCwTTuN6vcql1l7RObEWxcL3W/4oWPLY249VZOJU/XEWzqBbz4RDdjPz/VflhEPXx7vb6trcTaccVGSmWTecSnPks//IaWGXOjLqNjrsJaK6V+RtBBAYT4LfPw4iZIiLzeXTRAoGAEGkzCuoCMg6/ViwE4KlgLaspAE8TqUjSQD6it7B/zivFILqiPa8GOHb5yteOvb6E72sZ4MJ4+YBqwk08sE/R0Kr4tnyp1bvbCV+PWLZ80llbAzMnpIumkLGSuyldRRllxGBD1ocoEJj0crUnxUpSDU1nmdv8MdDHE3YbCJNSaBs=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh9pXjPKWdknB1deJBNos/aX+2bETxiKXwmSa8BMxD/6Qh7SBUF3CIJW7NvieTYZviAHr+ag/5T9QcGuB81QowmJCDwmfIqFxqgssv5smLJbJ1a2jmh2wjQ7gmfc86nY2FtYIxuteNqFEnswiflsC+OE1bna7kkOfgxBrOIMasjAP1Suw2lt5nBc7SF914yS0DsEhK/9UYhgb1Xtxt3lPwGn3cMUDcDRD+apfXWPnYJ8XJ1Okb/3R/rbXFMWR5i3LgnTgZcbzuZ45sI2de48tPNuMWkeP2xQ8z/CApfcAwXg2+GgoBoRFaSV0A+fp5DNBXCH6m5XiqmH1GshqgQunYQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/money/loan/page/payReturn";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    //public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
    // 沙箱网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";


    // 支付宝网关
    public static String log_path = "C:\\";

//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

